package com.taijihuabao.modules.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.taijihuabao.common.commonutils.LongToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;

/**
 * @author changhui.tu
 */
@Data
@ApiModel("公共实体基类")
@Component
public class BaseEntity implements Serializable {

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private Date creatorTime;

    /**
     * 创建用户
     */
    @ApiModelProperty(value = "创建用户")
    @JsonSerialize(using = LongToStringSerializer.class)
    private Long creatorUserId;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    private Date lastModifyTime;

    /**
     * 修改用户
     */
    @ApiModelProperty(value = "修改用户")
    @JsonSerialize(using = LongToStringSerializer.class)
    private Long lastModifyUserId;

    /**
     * 删除时间
     */
    @ApiModelProperty(value = "删除时间")
    private Date deleteTime;

    /**
     * 删除用户
     */
    @ApiModelProperty(value = "删除用户")
    @JsonSerialize(using = LongToStringSerializer.class)
    private Long deleteUserId;

    /**
     * 删除标志  逻辑删除（0 删除,1 未删除、）
     */
    @ApiModelProperty(value = "删除标志")
    private Long deleteMark;

    public BaseEntity() {
    }

    public BaseEntity(Long creatorUserId, Date creatorTime) {
        this.creatorTime = creatorTime;
        this.creatorUserId = creatorUserId;
    }

    public BaseEntity(Date deleteTime, Long deleteUserId) {
        this.deleteTime = deleteTime;
        this.deleteUserId = deleteUserId;
    }

}
